package com.admission.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import org.springside.modules.orm.Page;
import org.springside.modules.orm.PropertyFilter;

import com.admission.dao.SpecialSiteDao;
import com.admission.model.SpecialSite;

@Repository
@Transactional
public class SpecialSiteManager {
	private SpecialSiteDao specialSiteDao;

	/**
	 * 通过id找唯一对象，无返回null
	 * 
	 * @param id
	 * @return
	 */
	public SpecialSite getById(String id) {
		return specialSiteDao.findUniqueBy("id", id);
	}

	/**
	 * 批量删除
	 * 
	 * @param Entity
	 * @return
	 */
	public void deleteById(String ids)  {
		for (String id : ids.split(",")) {
			specialSiteDao.delete(id.trim());
		}
	}

	/**
	 * 保存
	 * 
	 * @param Entity
	 * @return
	 */
	public void save(SpecialSite entity) {
		specialSiteDao.save(entity);
	}

	/**
	 * 通过page查询结果
	 * 
	 * @param page
	 * @param filters
	 * @return
	 */
	public Page<SpecialSite> getByFilter(final Page<SpecialSite> page,
			List<PropertyFilter> filters) {
		return specialSiteDao.findPage(page, filters);
	}

	public Page<SpecialSite> getPage(final Page<SpecialSite> page) {
		return specialSiteDao.findPage(page);
	}

	public SpecialSiteDao getSpecialSiteDao() {
		return specialSiteDao;
	}

	@Autowired
	public void setSpecialSiteDao(SpecialSiteDao specialSiteDao) {
		this.specialSiteDao = specialSiteDao;
	}
}
